#include"bits/stdc++.h"
using namespace std;
int n,m,a[101][101];
int main()
{
	cin>>n>>m;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			cin>>a[i][j];
		}
	}
	int max=a[1][1],min=a[1][1],max_x=1,max_y=1,min_x=1,min_y=1;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			if(a[i][j]>max)
			{
				max=a[i][j];
				max_x=i;
				max_y=j;
			}
			if(a[i][j]<min)
			{
				min=a[i][j];
				min_x=i;
				min_y=j;
			}
		}
	}
	cout<<max_x<<" "<<max_y<<endl<<min_x<<" "<<min_y;
}
